package pagingJson;

import java.util.ArrayList;
import java.util.List;

import net.sf.json.JSONArray;

public class CreateJson {

	public String getJson(int total, int start){
		String returnJson = "";
		
		
		List<PagingBean> listV = new ArrayList<PagingBean>();
		
		for (int i = start ; i < start+10; i++) {
			if ( i < total) 
				listV.add(this.listValue(i));
		}
		JSONArray jsonArray = JSONArray.fromObject(listV);
		
		returnJson = "{total:"+total+",rows:"+jsonArray+"}";
		
		return returnJson;
	}
	
	public PagingBean listValue(int i){
		PagingBean pJson = new PagingBean();
		pJson.setOrganization("string "+i);
		pJson.setSchedule("weryey"+i);
		pJson.setMy_id(i);
		pJson.setMyDate("2002-12-"+i+" 12:00:00");
		
		
		return pJson;
	}
}
